//
// Created by webturing on 2024/1/1.
//
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
#define endl '\n'
const int maxn = 100 + 50;
const int maxm = maxn * maxn;


int dis[maxn][maxn];
int n, m;
int ind[maxn];
int path[maxn], book[maxn];

bool Topsort() {
    queue<int> Q;
    int j = 0;
    do {
        for (int i = 0; i < n; i++) {
            if (ind[i] == 0 && book[i] == 0) {
                Q.push(i);
                book[i] = 1;
            }
        }
        if (Q.empty() && j < n)
            return false;
        int h = Q.front();
        path[j++] = h;
        Q.pop();
        for (int i = 0; i < n; i++) {
            if (dis[h][i] > 0) {
                dis[h][i] = 0;
                --ind[i];
                if (ind[i] == 0 && book[i] == 0) {
                    Q.push(i);
                    book[i] = 1;
                }
            }
        }
        if (j == n)return true;
    } while (Q.size());

    return false;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    ifstream fin("K.in");
    if (fin.good()) cin.rdbuf(fin.rdbuf());
    cin >> n;

    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++) {
            cin >> dis[i][j];
            if (dis[i][j] != 0) {
                ind[j]++;
            }
        }

    if (!Topsort()) {
        cout << "ERROR" << endl;
    } else {
        for (int j = 0; j < n; j++) {
            cout << path[j] << " ";
        }
        cout << endl;
    }

    return 0;
}
